# list1=[1,2,3,4]
# list2=['a','b','c']
# list1.append(5)#列表添加
# print(list1)
# list2.append('d')
# print(list2)
# # list1=list1+list2#拼接
# # print(list1)
# list2.extend(list1)#扩展
#
# print(list2)
# list2.pop(2)#根据下标删除
#
# print(list2)
# list2.pop()#默认从后向前删除
# print(list2)
# list2.remove('b')#根据名称删除
# print(list2)
# # list2.clear('d')#删除所有d
# #del list2#删除列表
# list3=[1,2,'1','1','1',3,41,5,1,1,6,2,7]
# sum=0
# for i in list3:
#     if '1' in list3:
#         list3.remove('1')
# print(list3)
# #替换
# index=list3.index(2)
# #index=list3.index(2,1，5)#从下标1到5之间寻找第一个2
# list3[index]=8
# print(list3)
#
# # list3.insert(1,8)#插入
# # print(list3)
# # list3
#
# #统计1的个数
# print(list3.count(1))

#列表推导式[ i for  i in 可迭代器元祖，列表，字典，字符串]range(起点，终点，步长)
# import functools
#
# list1=[i+2 for i in range(1,21)]
# print(list1)
# list1=[i for i in range(1,21) if i%2==0]
# print(list1)
# #
# list2=['62','hello','100','word','high','88']
# #字母
# list3=[word for word in list2  if word.isalpha()]
# print(list3)
# #h开头大写，其余全大写
# list3=[word.title() if word.startswith('h') else word.upper() for word in list2]
# print(list3)
#
# list4=[(i,j) for  i in range(1,3) for j in range(1,3)]
# print(list4)
#
# l=[1,2,3,4,5,6]
# def s(x,y):
#     if x>y:
#         return -1
#     else:
#         return 1
# l.sort(key=functools.cmp_to_key(s))
# print(l)